{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f75b6db5-af6d-4c10-a092-a399b25077bb",
   "metadata": {},
   "outputs": [],
   "source": [
    "from bs4 import BeautifulSoup\n",
    "import requests\n",
    "import re\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import json\n",
    "url = 'http://www.moa.gov.cn/ztzl/zgnmfsj/xwzx/201809/t20180913_6157258.htm'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "1d9d845d-5d23-4e6f-8d4b-72bedcc46852",
   "metadata": {},
   "outputs": [],
   "source": [
    "r = requests.get(url)\n",
    "r.encoding = r.apparent_encoding"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1e36942d-fc57-40e7-a44d-7bb3c7814945",
   "metadata": {},
   "outputs": [],
   "source": [
    "prov= None\n",
    "meal= None\n",
    "meal_img_dict = {}\n",
    "meal_df = pd.DataFrame(columns = ['prov','meal'])\n",
    "soup = BeautifulSoup(r.text)\n",
    "\n",
    "for tag in soup.find_all('p'):\n",
    "    if tag.find_all('strong'):\n",
    "        prov = tag.text     \n",
    "    else:\n",
    "        try: \n",
    "            if tag['class']:\n",
    "                meal_list = re.findall(re.compile(r'[\\d]+.[\\w]+'),tag.text)\n",
    "                img_list = tag.find_all('img')\n",
    "                if len(meal_list)>0:\n",
    "                    meal = meal_list[0]\n",
    "                    meal_df = pd.concat([meal_df, pd.DataFrame([[prov,meal]],columns = ['prov','meal'])])\n",
    "                if len(img_list)>0:\n",
    "                    meal_img_dict[meal] = img_list[0]['src']    \n",
    "        except Exception:\n",
    "            continue"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "dd317f3b-065f-44c5-92df-b09288ac79a7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>prov</th>\n",
       "      <th>meal</th>\n",
       "      <th>code</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>海南省</td>\n",
       "      <td>东山羊</td>\n",
       "      <td>海南</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>海南省</td>\n",
       "      <td>抱罗粉</td>\n",
       "      <td>海南</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>江苏省</td>\n",
       "      <td>羊方藏鱼</td>\n",
       "      <td>江苏</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>江苏省</td>\n",
       "      <td>盐水鸭</td>\n",
       "      <td>江苏</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>江苏省</td>\n",
       "      <td>松鼠鳜鱼</td>\n",
       "      <td>江苏</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  prov  meal code\n",
       "0  海南省   东山羊   海南\n",
       "0  海南省   抱罗粉   海南\n",
       "0  江苏省  羊方藏鱼   江苏\n",
       "0  江苏省   盐水鸭   江苏\n",
       "0  江苏省  松鼠鳜鱼   江苏"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "meal_df['prov'] = meal_df['prov'].str.strip('\\u3000')\n",
    "meal_df['code'] = meal_df['prov'].str[0:2]\n",
    "meal_df = meal_df[meal_df['meal']!='05039419号']\n",
    "meal_df['meal'] = pd.DataFrame(meal_df['meal'].str.split('、').to_list())[1].values\n",
    "meal_df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "43e71a37-ac34-4ec2-b35b-560e1bfa626d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['1、爆肚', '2、卤煮火烧', '3、老北京炸酱面', '4、老爆三', '5、贴饽饽熬小鱼', '6、狗不理包子', '7、蟹壳黄', '8、响油鳝糊', '9、鸡肉生煎馒头', '10、重庆小面', '11、重庆火锅', '12、重庆辣子鸡', '13、酸辣粉', '14、手扒肉', '15、涮羊肉', '16、烤全羊', '17、蒙古血肠', '18、烤羊肉串', '19、大盘鸡', '20、抓饭', '21、羊杂碎', '22、羊肉手抓', '23、辣爆羊羔肉', '24、芽豆藏香猪', '25、鲁朗石锅鸡', '26、风干牛羊肉', '27、烤乳猪', '28、五色糯米饭', '29、老友粉', '30、得莫利炖活鱼', '31、哈尔滨红肠', '32、杀猪菜', '33、鲶鱼烧茄子', '34、酸菜猪肉炖粉条', '35、熏肉大饼', '36、咸鱼饼子', '37、沟帮子熏鸡', '38、大连', '39、驴肉火烧', '40、万字扣肉', '41、御土荷叶鸡', '42、烩面', '43、胡辣汤', '44、鲤鱼焙面', '45、济南九转大肠', '46、把子肉', '47、淄博博山豆腐箱', '48、枣庄辣子鸡', '49、刀削面', '50、平遥牛肉', '51、过油肉', '52、羊肉泡馍', '53、腊汁肉夹馍', '54、安康蒸面', '55、岐山臊子面', '56、兰州清汤牛肉面', '57、百花全鸡', '58、酿皮子', '59、担担面', '60、回锅肉', '61、麻婆豆腐', '62、钵钵鸡', '63、互助葱花土鸡', '64、麻食', '65、口味虾', '66、剁椒鱼头', '67、湘西三下锅', '68、排骨藕汤', '69、清蒸武昌鱼', '70、红菜苔炒腊肉', '72、瓦罐汤', '73、鳅鱼钻豆腐', '74、三杯鸡', '75、臭鳜鱼', '76、小龙虾', '77、淮南牛肉汤', '78、一品锅', '79、咸菜大汤黄鱼', '80、黄鱼鲞烤猪肉', '81、竹笋炖排骨', '82、豆腐饺', '83、姜母鸭', '84、海蛎煎', '85、白切鸡', '86、潮汕牛肉丸', '87、荔湾艇仔粥', '88、横岗腊鸭', '89、稻草排骨', '90、酸汤鱼', '91、丝娃娃', '92、云南三剁', '93、野生菌火锅', '94、过桥米线', '95、文昌鸡', '96、东山羊', '97、抱罗粉', '98、羊方藏鱼', '99、盐水鸭', '100、松鼠鳜鱼'])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "meal_img_dict.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "c4656a4e-c135-43d3-ab19-0bd43c8c9d02",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\renb\\AppData\\Local\\Temp\\ipykernel_22856\\3118300717.py:3: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n",
      "  main_cities = all_cities_df[all_cities_df.sort_values(by='行政代码')['行政代码'].astype('str').str.find('0100')>0]\n",
      "C:\\Users\\renb\\AppData\\Local\\Temp\\ipykernel_22856\\3118300717.py:5: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  main_cities['code'] = main_cities['name'].str[0:2]\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>prov</th>\n",
       "      <th>meal</th>\n",
       "      <th>code</th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>lon</th>\n",
       "      <th>lat</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>北京市</td>\n",
       "      <td>爆肚</td>\n",
       "      <td>北京</td>\n",
       "      <td>110100</td>\n",
       "      <td>北京市</td>\n",
       "      <td>116.395645</td>\n",
       "      <td>39.929986</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>北京市</td>\n",
       "      <td>卤煮火烧</td>\n",
       "      <td>北京</td>\n",
       "      <td>110100</td>\n",
       "      <td>北京市</td>\n",
       "      <td>116.395645</td>\n",
       "      <td>39.929986</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>北京市</td>\n",
       "      <td>老北京炸酱面</td>\n",
       "      <td>北京</td>\n",
       "      <td>110100</td>\n",
       "      <td>北京市</td>\n",
       "      <td>116.395645</td>\n",
       "      <td>39.929986</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>天津市</td>\n",
       "      <td>老爆三</td>\n",
       "      <td>天津</td>\n",
       "      <td>120100</td>\n",
       "      <td>天津市</td>\n",
       "      <td>117.210813</td>\n",
       "      <td>39.143930</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>天津市</td>\n",
       "      <td>贴饽饽熬小鱼</td>\n",
       "      <td>天津</td>\n",
       "      <td>120100</td>\n",
       "      <td>天津市</td>\n",
       "      <td>117.210813</td>\n",
       "      <td>39.143930</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  prov    meal code      id name         lon        lat\n",
       "0  北京市      爆肚   北京  110100  北京市  116.395645  39.929986\n",
       "1  北京市    卤煮火烧   北京  110100  北京市  116.395645  39.929986\n",
       "2  北京市  老北京炸酱面   北京  110100  北京市  116.395645  39.929986\n",
       "3  天津市     老爆三   天津  120100  天津市  117.210813  39.143930\n",
       "4  天津市  贴饽饽熬小鱼   天津  120100  天津市  117.210813  39.143930"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "file = '../data/china_cities.csv'\n",
    "all_cities_df = pd.read_csv(file,encoding='gb18030')\n",
    "main_cities = all_cities_df[all_cities_df.sort_values(by='行政代码')['行政代码'].astype('str').str.find('0100')>0]\n",
    "main_cities.columns = ['id','name','lon','lat']\n",
    "main_cities['code'] = main_cities['name'].str[0:2]\n",
    "meal_city_df = pd.merge(left = meal_df,right=main_cities,on='code',how='left')\n",
    "meal_city_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "21a9e96b-8cd2-4efd-bb87-e0ba761232c1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>lon</th>\n",
       "      <th>lat</th>\n",
       "      <th>id</th>\n",
       "      <th>meal_list</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>辽宁省沈阳市</td>\n",
       "      <td>123.432791</td>\n",
       "      <td>41.808645</td>\n",
       "      <td>3</td>\n",
       "      <td>咸鱼饼子,沟帮子熏鸡,大连</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>重庆市</td>\n",
       "      <td>106.530635</td>\n",
       "      <td>29.544606</td>\n",
       "      <td>4</td>\n",
       "      <td>重庆小面,重庆火锅,重庆辣子鸡,酸辣粉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>陕西省西安市</td>\n",
       "      <td>108.953098</td>\n",
       "      <td>34.277800</td>\n",
       "      <td>4</td>\n",
       "      <td>羊肉泡馍,腊汁肉夹馍,安康蒸面,岐山臊子面</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>青海省西宁市</td>\n",
       "      <td>101.767921</td>\n",
       "      <td>36.640739</td>\n",
       "      <td>2</td>\n",
       "      <td>互助葱花土鸡,麻食</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>黑龙江省哈尔滨市</td>\n",
       "      <td>126.657717</td>\n",
       "      <td>45.773225</td>\n",
       "      <td>3</td>\n",
       "      <td>得莫利炖活鱼,哈尔滨红肠,杀猪菜</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        name         lon        lat  id              meal_list\n",
       "26    辽宁省沈阳市  123.432791  41.808645   3          咸鱼饼子,沟帮子熏鸡,大连\n",
       "27       重庆市  106.530635  29.544606   4    重庆小面,重庆火锅,重庆辣子鸡,酸辣粉\n",
       "28    陕西省西安市  108.953098  34.277800   4  羊肉泡馍,腊汁肉夹馍,安康蒸面,岐山臊子面\n",
       "29    青海省西宁市  101.767921  36.640739   2              互助葱花土鸡,麻食\n",
       "30  黑龙江省哈尔滨市  126.657717  45.773225   3       得莫利炖活鱼,哈尔滨红肠,杀猪菜"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "meal_city_df_count = meal_city_df.groupby('code').agg({'name':'first','lon':'first','lat':'first','id':'count'})\n",
    "meal_list  = meal_city_df.groupby('name')['meal'].apply(list).to_frame().reset_index()\n",
    "meal_list.columns = ['name','meal_list']\n",
    "meal_list['meal_list'] = meal_list['meal_list'].str.join(\",\")\n",
    "meal_city_df_count = pd.merge(left = meal_city_df_count,right = meal_list,on='name')\n",
    "meal_city_df_count.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "2cedf7c3-f059-4856-8c1e-e290baf684ce",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<html>\n",
       "<head><meta charset=\"utf-8\" /></head>\n",
       "<body>\n",
       "    <div>            <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script>                <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n",
       "        <script src=\"https://cdn.plot.ly/plotly-2.9.0.min.js\"></script>                <div id=\"6f1d4408-c2c2-4370-a34a-e7601c5924a7\" class=\"plotly-graph-div\" style=\"height:1200px; width:1600px;\"></div>            <script type=\"text/javascript\">                                    window.PLOTLYENV=window.PLOTLYENV || {};                                    if (document.getElementById(\"6f1d4408-c2c2-4370-a34a-e7601c5924a7\")) {                    Plotly.newPlot(                        \"6f1d4408-c2c2-4370-a34a-e7601c5924a7\",                        [{\"hoverinfo\":\"text\",\"hovertext\":[[\"\\u4e0a\\u6d77\\u5e02\",\"\\u87f9\\u58f3\\u9ec4,\\u54cd\\u6cb9\\u9cdd\\u7cca,\\u9e21\\u8089\\u751f\\u714e\\u9992\\u5934\"],[\"\\u4e91\\u5357\\u7701\\u6606\\u660e\\u5e02\",\"\\u4e91\\u5357\\u4e09\\u5241,\\u91ce\\u751f\\u83cc\\u706b\\u9505,\\u8fc7\\u6865\\u7c73\\u7ebf\"],[\"\\u5185\\u8499\\u53e4\\u547c\\u548c\\u6d69\\u7279\\u5e02\",\"\\u624b\\u6252\\u8089,\\u6dae\\u7f8a\\u8089,\\u70e4\\u5168\\u7f8a,\\u8499\\u53e4\\u8840\\u80a0\"],[\"\\u5317\\u4eac\\u5e02\",\"\\u7206\\u809a,\\u5364\\u716e\\u706b\\u70e7,\\u8001\\u5317\\u4eac\\u70b8\\u9171\\u9762\"],[\"\\u5409\\u6797\\u7701\\u957f\\u6625\\u5e02\",\"\\u9cb6\\u9c7c\\u70e7\\u8304\\u5b50,\\u9178\\u83dc\\u732a\\u8089\\u7096\\u7c89\\u6761,\\u718f\\u8089\\u5927\\u997c\"],[\"\\u56db\\u5ddd\\u7701\\u6210\\u90fd\\u5e02\",\"\\u62c5\\u62c5\\u9762,\\u56de\\u9505\\u8089,\\u9ebb\\u5a46\\u8c46\\u8150,\\u94b5\\u94b5\\u9e21\"],[\"\\u5929\\u6d25\\u5e02\",\"\\u8001\\u7206\\u4e09,\\u8d34\\u997d\\u997d\\u71ac\\u5c0f\\u9c7c,\\u72d7\\u4e0d\\u7406\\u5305\\u5b50\"],[\"\\u5b81\\u590f\\u94f6\\u5ddd\\u5e02\",\"\\u7f8a\\u6742\\u788e,\\u7f8a\\u8089\\u624b\\u6293,\\u8fa3\\u7206\\u7f8a\\u7f94\\u8089\"],[\"\\u5b89\\u5fbd\\u7701\\u5408\\u80a5\\u5e02\",\"\\u81ed\\u9cdc\\u9c7c,\\u5c0f\\u9f99\\u867e,\\u6dee\\u5357\\u725b\\u8089\\u6c64,\\u4e00\\u54c1\\u9505\"],[\"\\u5c71\\u4e1c\\u7701\\u6d4e\\u5357\\u5e02\",\"\\u6d4e\\u5357\\u4e5d\\u8f6c\\u5927\\u80a0,\\u628a\\u5b50\\u8089,\\u6dc4\\u535a\\u535a\\u5c71\\u8c46\\u8150\\u7bb1,\\u67a3\\u5e84\\u8fa3\\u5b50\\u9e21\"],[\"\\u5c71\\u897f\\u7701\\u592a\\u539f\\u5e02\",\"\\u5200\\u524a\\u9762,\\u5e73\\u9065\\u725b\\u8089,\\u8fc7\\u6cb9\\u8089\"],[\"\\u5e7f\\u4e1c\\u7701\\u5e7f\\u5dde\\u5e02\",\"\\u767d\\u5207\\u9e21,\\u6f6e\\u6c55\\u725b\\u8089\\u4e38,\\u8354\\u6e7e\\u8247\\u4ed4\\u7ca5,\\u6a2a\\u5c97\\u814a\\u9e2d\"],[\"\\u5e7f\\u897f\\u5357\\u5b81\\u5e02\",\"\\u70e4\\u4e73\\u732a,\\u4e94\\u8272\\u7cef\\u7c73\\u996d,\\u8001\\u53cb\\u7c89\"],[\"\\u65b0\\u7586\\u4e4c\\u9c81\\u6728\\u9f50\\u5e02\",\"\\u70e4\\u7f8a\\u8089\\u4e32,\\u5927\\u76d8\\u9e21,\\u6293\\u996d\"],[\"\\u6c5f\\u82cf\\u7701\\u5357\\u4eac\\u5e02\",\"\\u7f8a\\u65b9\\u85cf\\u9c7c,\\u76d0\\u6c34\\u9e2d,\\u677e\\u9f20\\u9cdc\\u9c7c\"],[\"\\u6c5f\\u897f\\u7701\\u5357\\u660c\\u5e02\",\"\\u74e6\\u7f50\\u6c64,\\u9cc5\\u9c7c\\u94bb\\u8c46\\u8150,\\u4e09\\u676f\\u9e21\"],[\"\\u6cb3\\u5317\\u7701\\u77f3\\u5bb6\\u5e84\\u5e02\",\"\\u9a74\\u8089\\u706b\\u70e7,\\u4e07\\u5b57\\u6263\\u8089,\\u5fa1\\u571f\\u8377\\u53f6\\u9e21\"],[\"\\u6cb3\\u5357\\u7701\\u90d1\\u5dde\\u5e02\",\"\\u70e9\\u9762,\\u80e1\\u8fa3\\u6c64,\\u9ca4\\u9c7c\\u7119\\u9762\"],[\"\\u6d59\\u6c5f\\u7701\\u676d\\u5dde\\u5e02\",\"\\u54b8\\u83dc\\u5927\\u6c64\\u9ec4\\u9c7c,\\u9ec4\\u9c7c\\u9c9e\\u70e4\\u732a\\u8089,\\u7af9\\u7b0b\\u7096\\u6392\\u9aa8\"],[\"\\u6d77\\u5357\\u7701\\u6d77\\u53e3\\u5e02\",\"\\u6587\\u660c\\u9e21,\\u4e1c\\u5c71\\u7f8a,\\u62b1\\u7f57\\u7c89\"],[\"\\u6e56\\u5317\\u7701\\u6b66\\u6c49\\u5e02\",\"\\u6392\\u9aa8\\u85d5\\u6c64,\\u6e05\\u84b8\\u6b66\\u660c\\u9c7c,\\u7ea2\\u83dc\\u82d4\\u7092\\u814a\\u8089\"],[\"\\u6e56\\u5357\\u7701\\u957f\\u6c99\\u5e02\",\"\\u53e3\\u5473\\u867e,\\u5241\\u6912\\u9c7c\\u5934,\\u6e58\\u897f\\u4e09\\u4e0b\\u9505\"],[\"\\u7518\\u8083\\u7701\\u5170\\u5dde\\u5e02\",\"\\u5170\\u5dde\\u6e05\\u6c64\\u725b\\u8089\\u9762,\\u767e\\u82b1\\u5168\\u9e21,\\u917f\\u76ae\\u5b50\"],[\"\\u798f\\u5efa\\u7701\\u798f\\u5dde\\u5e02\",\"\\u8c46\\u8150\\u997a,\\u59dc\\u6bcd\\u9e2d,\\u6d77\\u86ce\\u714e\"],[\"\\u897f\\u85cf\\u62c9\\u8428\\u5e02\",\"\\u82bd\\u8c46\\u85cf\\u9999\\u732a,\\u9c81\\u6717\\u77f3\\u9505\\u9e21,\\u98ce\\u5e72\\u725b\\u7f8a\\u8089\"],[\"\\u8d35\\u5dde\\u7701\\u8d35\\u9633\\u5e02\",\"\\u7a3b\\u8349\\u6392\\u9aa8,\\u9178\\u6c64\\u9c7c,\\u4e1d\\u5a03\\u5a03\"],[\"\\u8fbd\\u5b81\\u7701\\u6c88\\u9633\\u5e02\",\"\\u54b8\\u9c7c\\u997c\\u5b50,\\u6c9f\\u5e2e\\u5b50\\u718f\\u9e21,\\u5927\\u8fde\"],[\"\\u91cd\\u5e86\\u5e02\",\"\\u91cd\\u5e86\\u5c0f\\u9762,\\u91cd\\u5e86\\u706b\\u9505,\\u91cd\\u5e86\\u8fa3\\u5b50\\u9e21,\\u9178\\u8fa3\\u7c89\"],[\"\\u9655\\u897f\\u7701\\u897f\\u5b89\\u5e02\",\"\\u7f8a\\u8089\\u6ce1\\u998d,\\u814a\\u6c41\\u8089\\u5939\\u998d,\\u5b89\\u5eb7\\u84b8\\u9762,\\u5c90\\u5c71\\u81ca\\u5b50\\u9762\"],[\"\\u9752\\u6d77\\u7701\\u897f\\u5b81\\u5e02\",\"\\u4e92\\u52a9\\u8471\\u82b1\\u571f\\u9e21,\\u9ebb\\u98df\"],[\"\\u9ed1\\u9f99\\u6c5f\\u7701\\u54c8\\u5c14\\u6ee8\\u5e02\",\"\\u5f97\\u83ab\\u5229\\u7096\\u6d3b\\u9c7c,\\u54c8\\u5c14\\u6ee8\\u7ea2\\u80a0,\\u6740\\u732a\\u83dc\"]],\"lat\":[31.249162,25.049153,40.828319,39.929986,43.898338,30.679943,39.14393,38.502621,31.866942,36.682785,37.890277,23.120049,22.806493,43.84038,32.057236,28.689578,38.048958,34.75661,30.259244,20.022071,30.581084,28.213478,36.064226,26.047125,29.662557,26.629907,41.808645,29.544606,34.2778,36.640739,45.773225],\"lon\":[121.487899,102.714601,111.660351,116.395645,125.313642,104.067923,117.210813,106.206479,117.282699,117.024967,112.550864,113.30765,108.297234,87.564988,118.778074,115.893528,114.522082,113.649644,120.219375,110.330802,114.3162,112.979353,103.823305,119.330221,91.111891,106.709177,123.432791,106.530635,108.953098,101.767921,126.657717],\"marker\":{\"color\":\"orange\",\"size\":[30,30,40,30,30,40,30,30,40,40,30,40,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,40,40,20,30]},\"mode\":\"markers+text\",\"text\":[\"\\u87f9\\u58f3\\u9ec4,\\u54cd\\u6cb9\\u9cdd\\u7cca,\\u9e21\\u8089\\u751f\\u714e\\u9992\\u5934\",\"\\u4e91\\u5357\\u4e09\\u5241,\\u91ce\\u751f\\u83cc\\u706b\\u9505,\\u8fc7\\u6865\\u7c73\\u7ebf\",\"\\u624b\\u6252\\u8089,\\u6dae\\u7f8a\\u8089,\\u70e4\\u5168\\u7f8a,\\u8499\\u53e4\\u8840\\u80a0\",\"\\u7206\\u809a,\\u5364\\u716e\\u706b\\u70e7,\\u8001\\u5317\\u4eac\\u70b8\\u9171\\u9762\",\"\\u9cb6\\u9c7c\\u70e7\\u8304\\u5b50,\\u9178\\u83dc\\u732a\\u8089\\u7096\\u7c89\\u6761,\\u718f\\u8089\\u5927\\u997c\",\"\\u62c5\\u62c5\\u9762,\\u56de\\u9505\\u8089,\\u9ebb\\u5a46\\u8c46\\u8150,\\u94b5\\u94b5\\u9e21\",\"\\u8001\\u7206\\u4e09,\\u8d34\\u997d\\u997d\\u71ac\\u5c0f\\u9c7c,\\u72d7\\u4e0d\\u7406\\u5305\\u5b50\",\"\\u7f8a\\u6742\\u788e,\\u7f8a\\u8089\\u624b\\u6293,\\u8fa3\\u7206\\u7f8a\\u7f94\\u8089\",\"\\u81ed\\u9cdc\\u9c7c,\\u5c0f\\u9f99\\u867e,\\u6dee\\u5357\\u725b\\u8089\\u6c64,\\u4e00\\u54c1\\u9505\",\"\\u6d4e\\u5357\\u4e5d\\u8f6c\\u5927\\u80a0,\\u628a\\u5b50\\u8089,\\u6dc4\\u535a\\u535a\\u5c71\\u8c46\\u8150\\u7bb1,\\u67a3\\u5e84\\u8fa3\\u5b50\\u9e21\",\"\\u5200\\u524a\\u9762,\\u5e73\\u9065\\u725b\\u8089,\\u8fc7\\u6cb9\\u8089\",\"\\u767d\\u5207\\u9e21,\\u6f6e\\u6c55\\u725b\\u8089\\u4e38,\\u8354\\u6e7e\\u8247\\u4ed4\\u7ca5,\\u6a2a\\u5c97\\u814a\\u9e2d\",\"\\u70e4\\u4e73\\u732a,\\u4e94\\u8272\\u7cef\\u7c73\\u996d,\\u8001\\u53cb\\u7c89\",\"\\u70e4\\u7f8a\\u8089\\u4e32,\\u5927\\u76d8\\u9e21,\\u6293\\u996d\",\"\\u7f8a\\u65b9\\u85cf\\u9c7c,\\u76d0\\u6c34\\u9e2d,\\u677e\\u9f20\\u9cdc\\u9c7c\",\"\\u74e6\\u7f50\\u6c64,\\u9cc5\\u9c7c\\u94bb\\u8c46\\u8150,\\u4e09\\u676f\\u9e21\",\"\\u9a74\\u8089\\u706b\\u70e7,\\u4e07\\u5b57\\u6263\\u8089,\\u5fa1\\u571f\\u8377\\u53f6\\u9e21\",\"\\u70e9\\u9762,\\u80e1\\u8fa3\\u6c64,\\u9ca4\\u9c7c\\u7119\\u9762\",\"\\u54b8\\u83dc\\u5927\\u6c64\\u9ec4\\u9c7c,\\u9ec4\\u9c7c\\u9c9e\\u70e4\\u732a\\u8089,\\u7af9\\u7b0b\\u7096\\u6392\\u9aa8\",\"\\u6587\\u660c\\u9e21,\\u4e1c\\u5c71\\u7f8a,\\u62b1\\u7f57\\u7c89\",\"\\u6392\\u9aa8\\u85d5\\u6c64,\\u6e05\\u84b8\\u6b66\\u660c\\u9c7c,\\u7ea2\\u83dc\\u82d4\\u7092\\u814a\\u8089\",\"\\u53e3\\u5473\\u867e,\\u5241\\u6912\\u9c7c\\u5934,\\u6e58\\u897f\\u4e09\\u4e0b\\u9505\",\"\\u5170\\u5dde\\u6e05\\u6c64\\u725b\\u8089\\u9762,\\u767e\\u82b1\\u5168\\u9e21,\\u917f\\u76ae\\u5b50\",\"\\u8c46\\u8150\\u997a,\\u59dc\\u6bcd\\u9e2d,\\u6d77\\u86ce\\u714e\",\"\\u82bd\\u8c46\\u85cf\\u9999\\u732a,\\u9c81\\u6717\\u77f3\\u9505\\u9e21,\\u98ce\\u5e72\\u725b\\u7f8a\\u8089\",\"\\u7a3b\\u8349\\u6392\\u9aa8,\\u9178\\u6c64\\u9c7c,\\u4e1d\\u5a03\\u5a03\",\"\\u54b8\\u9c7c\\u997c\\u5b50,\\u6c9f\\u5e2e\\u5b50\\u718f\\u9e21,\\u5927\\u8fde\",\"\\u91cd\\u5e86\\u5c0f\\u9762,\\u91cd\\u5e86\\u706b\\u9505,\\u91cd\\u5e86\\u8fa3\\u5b50\\u9e21,\\u9178\\u8fa3\\u7c89\",\"\\u7f8a\\u8089\\u6ce1\\u998d,\\u814a\\u6c41\\u8089\\u5939\\u998d,\\u5b89\\u5eb7\\u84b8\\u9762,\\u5c90\\u5c71\\u81ca\\u5b50\\u9762\",\"\\u4e92\\u52a9\\u8471\\u82b1\\u571f\\u9e21,\\u9ebb\\u98df\",\"\\u5f97\\u83ab\\u5229\\u7096\\u6d3b\\u9c7c,\\u54c8\\u5c14\\u6ee8\\u7ea2\\u80a0,\\u6740\\u732a\\u83dc\"],\"type\":\"scattermapbox\"}],                        {\"template\":{\"data\":{\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattermapbox\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolar\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolargl\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"#EBF0F8\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"#C8D4E3\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"colorscale\":{\"diverging\":[[0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"colorway\":[\"#636efa\",\"#EF553B\",\"#00cc96\",\"#ab63fa\",\"#FFA15A\",\"#19d3f3\",\"#FF6692\",\"#B6E880\",\"#FF97FF\",\"#FECB52\"],\"font\":{\"color\":\"#2a3f5f\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"#E5ECF6\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"mapbox\":{\"style\":\"light\"},\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"#E5ECF6\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"line\":{\"color\":\"#2a3f5f\"}},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"title\":{\"x\":0.05},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2}}},\"mapbox\":{\"center\":{\"lat\":34,\"lon\":108},\"zoom\":4,\"accesstoken\":\"pk.eyJ1IjoiYmluZ2JsYWNrYmVhbiIsImEiOiJjbDFla2Rtc2QwNnU1M2J1Z2pma2M3cXltIn0.ziqYuJ46fMfmuUT1fkHr1Q\",\"style\":\"streets\"},\"showlegend\":false,\"height\":1200,\"width\":1600},                        {\"responsive\": true}                    ).then(function(){\n",
       "                            \n",
       "var gd = document.getElementById('6f1d4408-c2c2-4370-a34a-e7601c5924a7');\n",
       "var x = new MutationObserver(function (mutations, observer) {{\n",
       "        var display = window.getComputedStyle(gd).display;\n",
       "        if (!display || display === 'none') {{\n",
       "            console.log([gd, 'removed!']);\n",
       "            Plotly.purge(gd);\n",
       "            observer.disconnect();\n",
       "        }}\n",
       "}});\n",
       "\n",
       "// Listen for the removal of the full notebook cells\n",
       "var notebookContainer = gd.closest('#notebook-container');\n",
       "if (notebookContainer) {{\n",
       "    x.observe(notebookContainer, {childList: true});\n",
       "}}\n",
       "\n",
       "// Listen for the clearing of the current output cell\n",
       "var outputEl = gd.closest('.output');\n",
       "if (outputEl) {{\n",
       "    x.observe(outputEl, {childList: true});\n",
       "}}\n",
       "\n",
       "                        })                };                            </script>        </div>\n",
       "</body>\n",
       "</html>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.graph_objects as go\n",
    "import plotly.io as pio\n",
    "from plotly.subplots import make_subplots\n",
    "pio.renderers.default = 'colab'\n",
    "fig = go.Figure()\n",
    "fig.add_trace(\n",
    "go.Scattermapbox(mode='markers+text', \n",
    "                                 lon = meal_city_df_count['lon'],\n",
    "                                 lat = meal_city_df_count['lat'],\n",
    "                                 hovertext = meal_city_df_count[['name','meal_list']],\n",
    "                                 hoverinfo = 'text',\n",
    "                 text = meal_city_df_count['meal_list'].tolist(),\n",
    "                                 marker=go.scattermapbox.Marker(\n",
    "           size=meal_city_df_count['id']*10,color='orange',\n",
    "        ),\n",
    "                                 )\n",
    ")\n",
    "fig.update_layout(mapbox_zoom=4,mapbox_accesstoken=map_box_token,mapbox_style=\"streets\",showlegend=False,height=1200,width=1600,mapbox_center = dict(lat=34,lon=108)\n",
    "    )\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "74dad60d-7b4c-4bf0-b1f0-4340abdcba33",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics.pairwise import haversine_distances\n",
    "from math import radians\n",
    "def geo_distance(p1,p2):\n",
    "    dis = haversine_distances([[radians(_) for _ in p1], [radians(_) for _ in p2]])[0][1]* 6371000/1000  # multiply by Earth radius to get kilometers\n",
    "    return dis\n",
    "from ortools.constraint_solver import routing_enums_pb2\n",
    "from ortools.constraint_solver import pywrapcp\n",
    "\n",
    "meal_city_df_count['loc'] = meal_city_df_count.apply(lambda x: list([x['lon'],\n",
    "                                        x['lat']]),axis=1)  \n",
    "xv,yv= np.meshgrid(meal_city_df_count['loc'], meal_city_df_count['loc'],indexing='ij')\n",
    "data = {}\n",
    "data['distance_matrix'] = [[round(geo_distance(xv[i][j],yv[i][j])) for i in range(xv.shape[0])] for j in range(xv.shape[1])] \n",
    "data['num_vehicles'] = 1\n",
    "data['depot'] = 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "4b68eb16-7f79-4dc6-9db7-8b08ae754795",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Objective: 10954 km\n",
      "Route for vehicle 0:\n",
      " 2 -> 10 -> 17 -> 16 -> 3 -> 6 -> 9 -> 8 -> 14 -> 26 -> 4 -> 30 -> 0 -> 18 -> 23 -> 15 -> 20 -> 21 -> 11 -> 19 -> 12 -> 25 -> 27 -> 5 -> 1 -> 13 -> 24 -> 29 -> 22 -> 7 -> 28 -> 2\n",
      "\n"
     ]
    }
   ],
   "source": [
    "def print_solution(manager, local_routing, solution):\n",
    "    \"\"\"Prints solution on console.\"\"\"\n",
    "    print('Objective: {} km'.format(solution.ObjectiveValue()))\n",
    "    index = local_routing.Start(0)\n",
    "    plan_output = 'Route for vehicle 0:\\n'\n",
    "    route_distance = 0\n",
    "    while not local_routing.IsEnd(index):\n",
    "        plan_output += ' {} ->'.format(manager.IndexToNode(index))\n",
    "        previous_index = index\n",
    "        index = solution.Value(local_routing.NextVar(index))\n",
    "        route_distance += local_routing.GetArcCostForVehicle(previous_index, index, 0)\n",
    "    plan_output += ' {}\\n'.format(manager.IndexToNode(index))\n",
    "    print(plan_output)\n",
    "    plan_output += 'Route distance: {}km\\n'.format(route_distance)\n",
    "\n",
    "# Create the routing index manager.\n",
    "manager = pywrapcp.RoutingIndexManager(len(data['distance_matrix']),\n",
    "                                       data['num_vehicles'], data['depot'])\n",
    "\n",
    "# Create Routing Model.\n",
    "my_routing = pywrapcp.RoutingModel(manager)\n",
    "def distance_callback(from_index, to_index):\n",
    "    \"\"\"Returns the distance between the two nodes.\"\"\"\n",
    "    # Convert from routing variable Index to distance matrix NodeIndex.\n",
    "    from_node = manager.IndexToNode(from_index)\n",
    "    to_node = manager.IndexToNode(to_index)\n",
    "    return data['distance_matrix'][from_node][to_node]\n",
    "transit_callback_index = my_routing.RegisterTransitCallback(distance_callback)\n",
    "# Define cost of each arc.\n",
    "my_routing.SetArcCostEvaluatorOfAllVehicles(transit_callback_index)\n",
    "\n",
    "# Setting first solution heuristic.\n",
    "search_parameters = pywrapcp.DefaultRoutingSearchParameters()\n",
    "search_parameters.first_solution_strategy = (\n",
    "    routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC)\n",
    "\n",
    "# Solve the problem.\n",
    "solution = my_routing.SolveWithParameters(search_parameters)\n",
    "# Print solution on console.\n",
    "if solution:\n",
    "    print_solution(manager, my_routing, solution)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "f126cce4-d856-4ca2-81ed-ff38537586bf",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_routes(solution, routing, manager):\n",
    "    \"\"\"Get vehicle routes from a solution and store them in an array.\"\"\"\n",
    "    # Get vehicle routes and store them in a two dimensional array whose\n",
    "    # i,j entry is the jth location visited by vehicle i along its route.\n",
    "    routes = []\n",
    "    for route_nbr in range(routing.vehicles()):\n",
    "        index = routing.Start(route_nbr)\n",
    "        route = [manager.IndexToNode(index)]\n",
    "        while not routing.IsEnd(index):\n",
    "            index = solution.Value(routing.NextVar(index))\n",
    "            route.append(manager.IndexToNode(index))\n",
    "        routes.append(route)\n",
    "    return routes\n",
    "routes = get_routes(solution, my_routing, manager)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "78679fe1-8cdf-4d5f-bf0f-229b9bac7f61",
   "metadata": {},
   "outputs": [],
   "source": [
    "routes_df = pd.Series(routes[0][:-1]).to_frame()\n",
    "meal_city_df_count['seq'] = routes_df.reset_index().sort_values(by=0)['index']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "a39fe348-d957-484d-a909-896457c9a223",
   "metadata": {},
   "outputs": [],
   "source": [
    "import shapely\n",
    "from shapely.geometry import LineString\n",
    "import plotly.express as px\n",
    "linestring = LineString([meal_city_df_count.iloc[routes[0][i],1:3].tolist() for i in range(32)])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "7388ce56-b641-4e17-9f89-dda58946034a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<html>\n",
       "<head><meta charset=\"utf-8\" /></head>\n",
       "<body>\n",
       "    <div>            <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script>                <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n",
       "        <script src=\"https://cdn.plot.ly/plotly-2.9.0.min.js\"></script>                <div id=\"cea7d28e-3674-44c2-8674-141a3dd37934\" class=\"plotly-graph-div\" style=\"height:1200px; width:1600px;\"></div>            <script type=\"text/javascript\">                                    window.PLOTLYENV=window.PLOTLYENV || {};                                    if (document.getElementById(\"cea7d28e-3674-44c2-8674-141a3dd37934\")) {                    Plotly.newPlot(                        \"cea7d28e-3674-44c2-8674-141a3dd37934\",                        [{\"hoverinfo\":\"text\",\"hovertext\":[\"\\u4e0a\\u6d77\\u5e02\",\"\\u4e91\\u5357\\u7701\\u6606\\u660e\\u5e02\",\"\\u5185\\u8499\\u53e4\\u547c\\u548c\\u6d69\\u7279\\u5e02\",\"\\u5317\\u4eac\\u5e02\",\"\\u5409\\u6797\\u7701\\u957f\\u6625\\u5e02\",\"\\u56db\\u5ddd\\u7701\\u6210\\u90fd\\u5e02\",\"\\u5929\\u6d25\\u5e02\",\"\\u5b81\\u590f\\u94f6\\u5ddd\\u5e02\",\"\\u5b89\\u5fbd\\u7701\\u5408\\u80a5\\u5e02\",\"\\u5c71\\u4e1c\\u7701\\u6d4e\\u5357\\u5e02\",\"\\u5c71\\u897f\\u7701\\u592a\\u539f\\u5e02\",\"\\u5e7f\\u4e1c\\u7701\\u5e7f\\u5dde\\u5e02\",\"\\u5e7f\\u897f\\u5357\\u5b81\\u5e02\",\"\\u65b0\\u7586\\u4e4c\\u9c81\\u6728\\u9f50\\u5e02\",\"\\u6c5f\\u82cf\\u7701\\u5357\\u4eac\\u5e02\",\"\\u6c5f\\u897f\\u7701\\u5357\\u660c\\u5e02\",\"\\u6cb3\\u5317\\u7701\\u77f3\\u5bb6\\u5e84\\u5e02\",\"\\u6cb3\\u5357\\u7701\\u90d1\\u5dde\\u5e02\",\"\\u6d59\\u6c5f\\u7701\\u676d\\u5dde\\u5e02\",\"\\u6d77\\u5357\\u7701\\u6d77\\u53e3\\u5e02\",\"\\u6e56\\u5317\\u7701\\u6b66\\u6c49\\u5e02\",\"\\u6e56\\u5357\\u7701\\u957f\\u6c99\\u5e02\",\"\\u7518\\u8083\\u7701\\u5170\\u5dde\\u5e02\",\"\\u798f\\u5efa\\u7701\\u798f\\u5dde\\u5e02\",\"\\u897f\\u85cf\\u62c9\\u8428\\u5e02\",\"\\u8d35\\u5dde\\u7701\\u8d35\\u9633\\u5e02\",\"\\u8fbd\\u5b81\\u7701\\u6c88\\u9633\\u5e02\",\"\\u91cd\\u5e86\\u5e02\",\"\\u9655\\u897f\\u7701\\u897f\\u5b89\\u5e02\",\"\\u9752\\u6d77\\u7701\\u897f\\u5b81\\u5e02\",\"\\u9ed1\\u9f99\\u6c5f\\u7701\\u54c8\\u5c14\\u6ee8\\u5e02\"],\"lat\":[31.249162,25.049153,40.828319,39.929986,43.898338,30.679943,39.14393,38.502621,31.866942,36.682785,37.890277,23.120049,22.806493,43.84038,32.057236,28.689578,38.048958,34.75661,30.259244,20.022071,30.581084,28.213478,36.064226,26.047125,29.662557,26.629907,41.808645,29.544606,34.2778,36.640739,45.773225],\"lon\":[121.487899,102.714601,111.660351,116.395645,125.313642,104.067923,117.210813,106.206479,117.282699,117.024967,112.550864,113.30765,108.297234,87.564988,118.778074,115.893528,114.522082,113.649644,120.219375,110.330802,114.3162,112.979353,103.823305,119.330221,91.111891,106.709177,123.432791,106.530635,108.953098,101.767921,126.657717],\"marker\":{\"color\":\"orange\",\"size\":[30,30,40,30,30,40,30,30,40,40,30,40,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,40,40,20,30]},\"mode\":\"markers\",\"type\":\"scattermapbox\"},{\"lat\":[40.828319,37.890277,34.75661,38.048958,39.929986,39.14393,36.682785,31.866942,32.057236,41.808645,43.898338,45.773225,31.249162,30.259244,26.047125,28.689578,30.581084,28.213478,23.120049,20.022071,22.806493,26.629907,29.544606,30.679943,25.049153,43.84038,29.662557,36.640739,36.064226,38.502621,34.2778,40.828319,null],\"line\":{\"color\":\"darksalmon\"},\"lon\":[111.660351,112.550864,113.649644,114.522082,116.395645,117.210813,117.024967,117.282699,118.778074,123.432791,125.313642,126.657717,121.487899,120.219375,119.330221,115.893528,114.3162,112.979353,113.30765,110.330802,108.297234,106.709177,106.530635,104.067923,102.714601,87.564988,91.111891,101.767921,103.823305,106.206479,108.953098,111.660351,null],\"mode\":\"markers+lines+text\",\"text\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\"],\"textfont\":{\"color\":\"lime\",\"family\":\"sans serif\",\"size\":18},\"type\":\"scattermapbox\"}],                        {\"template\":{\"data\":{\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattermapbox\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolar\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolargl\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"#EBF0F8\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"#C8D4E3\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"colorscale\":{\"diverging\":[[0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"colorway\":[\"#636efa\",\"#EF553B\",\"#00cc96\",\"#ab63fa\",\"#FFA15A\",\"#19d3f3\",\"#FF6692\",\"#B6E880\",\"#FF97FF\",\"#FECB52\"],\"font\":{\"color\":\"#2a3f5f\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"#E5ECF6\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"mapbox\":{\"style\":\"light\"},\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"#E5ECF6\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"line\":{\"color\":\"#2a3f5f\"}},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"title\":{\"x\":0.05},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2}}},\"legend\":{\"font\":{\"size\":12,\"color\":\"silver\"},\"bgcolor\":\"black\",\"yanchor\":\"top\",\"y\":0.99,\"xanchor\":\"left\",\"x\":0.01},\"mapbox\":{\"center\":{\"lat\":34,\"lon\":108},\"zoom\":4,\"accesstoken\":\"pk.eyJ1IjoiYmluZ2JsYWNrYmVhbiIsImEiOiJjbDFla2Rtc2QwNnU1M2J1Z2pma2M3cXltIn0.ziqYuJ46fMfmuUT1fkHr1Q\",\"style\":\"streets\"},\"showlegend\":false,\"height\":1200,\"width\":1600},                        {\"responsive\": true}                    ).then(function(){\n",
       "                            \n",
       "var gd = document.getElementById('cea7d28e-3674-44c2-8674-141a3dd37934');\n",
       "var x = new MutationObserver(function (mutations, observer) {{\n",
       "        var display = window.getComputedStyle(gd).display;\n",
       "        if (!display || display === 'none') {{\n",
       "            console.log([gd, 'removed!']);\n",
       "            Plotly.purge(gd);\n",
       "            observer.disconnect();\n",
       "        }}\n",
       "}});\n",
       "\n",
       "// Listen for the removal of the full notebook cells\n",
       "var notebookContainer = gd.closest('#notebook-container');\n",
       "if (notebookContainer) {{\n",
       "    x.observe(notebookContainer, {childList: true});\n",
       "}}\n",
       "\n",
       "// Listen for the clearing of the current output cell\n",
       "var outputEl = gd.closest('.output');\n",
       "if (outputEl) {{\n",
       "    x.observe(outputEl, {childList: true});\n",
       "}}\n",
       "\n",
       "                        })                };                            </script>        </div>\n",
       "</body>\n",
       "</html>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "lats = []\n",
    "lons = []\n",
    "names = []\n",
    "colors = []\n",
    "\n",
    "x, y = linestring.xy\n",
    "lats = np.append(lats, y)\n",
    "lons = np.append(lons, x)\n",
    "lats = np.append(lats, None)\n",
    "lons = np.append(lons, None)\n",
    "names = np.append(names, None)\n",
    "\n",
    "fig=  go.Figure()\n",
    "\n",
    "\n",
    "trace1 = go.Scattermapbox(mode='markers', \n",
    "                                 lon = meal_city_df_count['lon'],\n",
    "                                 lat = meal_city_df_count['lat'],\n",
    "                                 hovertext = meal_city_df_count['name'],\n",
    "                                 hoverinfo = 'text',\n",
    "                                 marker=go.scattermapbox.Marker(\n",
    "           size=meal_city_df_count['id']*10,color='orange'\n",
    "        ))\n",
    "trace2 = go.Scattermapbox(mode='markers+lines+text',lat=lats, lon=lons,\n",
    "                         text = meal_city_df_count['seq'].tolist(),\n",
    "                          textfont=dict(family=\"sans serif\",size=18,color='lime'),\n",
    "                          line=dict(color='darksalmon')\n",
    "        )\n",
    "fig.add_trace(trace1)\n",
    "fig.add_trace(trace2)\n",
    "fig.update_layout(\n",
    "    legend=dict(bgcolor='black',\n",
    "    font = dict(size=12,color='silver'),\n",
    "    yanchor=\"top\",\n",
    "    y=0.99,\n",
    "    xanchor=\"left\",\n",
    "    x=0.01),mapbox_zoom=4,mapbox_accesstoken=map_box_token,mapbox_style=\"streets\",showlegend=False,height=1200,width=1600,mapbox_center = dict(lat=34,lon=108))\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6e8b5c3c-3bfa-4a85-8b04-af0d42cedc3c",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "data_amber_source",
   "language": "python",
   "name": "data_amber_source"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
